<!doctype html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="utf-8">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
	<meta name="robots" content="index, follow">
    <link rel="shortcut icon" type="image/png" href="../favicon.png">

	<link rel="stylesheet" type="text/css" href="./css/bootstrap.min.css?9188" th:href="@{/css/bootstrap.min.css?9188}">
	<link rel="stylesheet" type="text/css" href="../../static/css/style.css?8116" th:href="@{/css/style.css?8116}">
	<link rel="stylesheet" type="text/css" href="./css/animate.min.css?7456" th:href="@{/css/animate.min.css?7456}">
	<link href='https://fonts.googleapis.com/css?family=Josefin+Sans&display=swap&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
	<link href='https://fonts.googleapis.com/css?family=Lato:100,300,400,700,900&display=swap&subset=latin,latin-ext' rel='stylesheet' type='text/css'>


	<title>finalize</title>


    
<!-- Analytics -->
 
<!-- Analytics END -->
    
</head>
<body>



<!-- Main container -->
<div class="page-container">
    
<!-- bloc-0 -->
<div class="bloc bg1 bgc-azure l-bloc " id="bloc-0">
	<div class="container bloc-sm">
		<div class="row">
			<div class="col">
				<nav th:replace="_fragments :: nav" class="navbar navbar-light row navbar-expand-md nav-invert" role="navigation">
					<button id="nav-toggle" type="button" class="ui-navbar-toggler navbar-toggler border-0 p-0" data-toggle="collapse" data-target=".navbar-27707" aria-expanded="false" aria-label="Toggle navigation">
						<span class="navbar-toggler-icon"></span>
					</button>
					<div class="collapse navbar-collapse navbar-27707">
						<ul class="site-navigation nav navbar-nav">
							<li class="nav-item">
								<a href="loginup.html" th:href="@{/}" class="nav-link a-btn ltc-white">首页</a>
							</li>
							<li th:if="${session.nowUser.ifHasRight(1)}" class="nav-item">
								<a href="contract/draft.html" th:href="@{/toDraft}" class="nav-link a-btn ltc-white">起草合同</a>
							</li>
							<li th:if="${session.nowUser.ifHasRight(5)}" class="nav-item">
								<a href="select.html" th:href="@{/toCounterSign}" class="nav-link a-btn ltc-white">会签合同</a>
							</li>
							<li th:if="${session.nowUser.ifHasRight(2)}" class="nav-item">
								<a href="finalization.html" th:href="@{/toFinalize}" class="nav-link a-btn ltc-white">定稿合同</a>
							</li>
							<li th:if="${session.nowUser.ifHasRight(6)}" class="nav-item">
								<a href="approval.html" th:href="@{/toExamine}" class="nav-link a-btn ltc-white">审批合同</a>
							</li>
							<li th:if="${session.nowUser.ifHasRight(7)}" class="nav-item">
								<a href="sign.html" th:href="@{/toSign}" class="nav-link a-btn ltc-white">签订合同</a>
							</li>
						</ul>
					</div>
					<a class="navbar-brand mr-0" href="/toMe"> xzx <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-person-fill" viewBox="0 0 16 16"><path d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/></svg></a>

				</nav>
			</div>
		</div>
	</div>
</div>
<!-- bloc-0 END -->

<!-- bloc-8 -->
<div class="bloc bg2 l-bloc" id="bloc-8">
	<div class="container bloc-lg">
		<div class="row"style="background-color: rgba(255,255,255,.2)">
			<div class="col-lg-6">
				<h1 th:if="${finalize!=null}" class="mg-md">
					会签意见
				</h1>
				<div th:if="${finalize!=null}" class="row">
					<textarea readonly="true"  th:text="${counterSignOpinion}" name="content" id="content" class="form-control" rows="29" cols="50" required>kevin : 希望字体再大一点&#10;bruce : 附件再完善一下&#10;mike : 很好！&#10;bruce : 附件再完善一下asdasdassssssssssssssssssssssssqwewqeq大苏打实打实的阿达萨达萨达萨达萨达是小区围墙外的是否撒大苏打撒旦撒大苏打撒旦2&#10;bruce : 附件再完善一下&#10;bruce : 附件再完善一下&#10;bruce : 附件再完善一下&#10;bruce : 附件再完善一下</textarea>
				</div>
				<h1 th:if="${exam!=null}" class="mg-md">
					审批意见
				</h1>
				<div th:if="${exam!=null}" class="row">
					<textarea  readonly="true" th:text="${examOpinion}" name="content" id="content" class="form-control" rows="29" cols="50" required>kevin : 希望字体再大一点&#10;bruce : 附件再完善一下&#10;mike : 很好！&#10;bruce : 附件再完善一下asdasdassssssssssssssssssssssssqwewqeq大苏打实打实的阿达萨达萨达萨达萨达是小区围墙外的是否撒大苏打撒旦撒大苏打撒旦2&#10;bruce : 附件再完善一下&#10;bruce : 附件再完善一下&#10;bruce : 附件再完善一下&#10;bruce : 附件再完善一下</textarea>
				</div>
			</div>
			<div class=" col-lg-6 ">
				<form id="form_26540" th:action="@{/contract/finalize}" method="post" enctype="multipart/form-data">
					<input type="hidden" name="contractid" th:value="${contractObject.contractid}">
					<h1 class="mg-md">
						定稿合同
					</h1>
					<div class="form-group">
						<label>
							合同名称<br>
						</label>
						<input type="text" th:value="${contractObject.contractname}" name="contractname" id="name_26540" class="form-control" required data-validation-required-message="合同名称是必要的"/>
						<div style="color:red">
							<label v-show="checkContract">合同名称不为空</label>
						</div>
					</div>
					<div class="form-group">
						<label>
							合同生效时间<br>
						</label>
						<input th:value="${contractObject.beginTimeStr}" name="beginTimeStr" id="start_time" class="form-control" type="date" required data-validation-required-message="时间是必要的" />
						<div style="color:red">
							<label v-if="checkBeginTime">开始时间不为空</label>
						</div>
					</div>
					<div class="form-group">
						<label>
							合同失效时间<br>
						</label>
						<input th:value="${contractObject.endTimeStr}" name="endTimeStr" id="end_time" class="form-control" type="date" required data-validation-required-message="时间是必要的" />
						<div style="color:red">
							<label v-if="checkEndTime">结束时间不为空</label>
						</div>
						<div style="color:red">
							<label v-if="checkEndTime2">结束时间大于开始时间</label>
						</div>
					</div>
					<div class="form-group">
						<label>
							合同内容<br>
						</label><textarea th:text="${contractObject.content}" name="content" id="content" class="form-control" rows="4" cols="50" required></textarea>
					</div>
					<div class="form-group container-div-0-style">
						<label>
							客户<br>
						</label>
						<div class="row">
							<div class="col-lg-8">
								<select  id="select_customer" name="customerid" class="form-control">
									<option name="yy" value="qqqq"  th:each="custmoer : ${customers}" th:value="${custmoer.getCustomerid()}" th:text="${custmoer.getCustomername()}" >1111</option>
								</select>
							</div>
							<div th:if="${session.nowUser.ifHasRight(16)}" class="col">
								<a th:href="@{/toAddCustomer}" class="form-control btn btn-success">你也可以新增客户</a>
							</div>
						</div>
					</div>
					<div th:if="${file.contractid!=null}" class="form-group container-div-0-style">
						<label>
							当前附件:<span th:text="${file.getFilename()}"></span>
						</label>
						<div class="row">
							<div class="col-lg">
								<a th:if="${file.contractid!=null}" href="" th:href="@{|/fileDown/${file.getFilename()}/${file.getContractid()}|}">下载附件</a>
							</div>
						</div>
					</div>
					<div class="form-group container-div-0-style">
						<label>
							上传附件<br>
						</label>
						<div class="row">
							<div class="col-lg-9">
								<input type="file" class="file" name="upload" multiple="multiple">
							</div>
						</div>
					</div>
					<button v-on:click="send()" class="bloc-button btn btn-lg btn-block btn-azure" type="button" >
						定稿合同<br>
					</button>
				</form>
			</div>

		</div>
	</div>
</div>
<!-- bloc-8 END -->

<!-- ScrollToTop Button -->
<a class="bloc-button btn btn-d scrollToTop" onclick="scrollToTarget('1',this)"><svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 32 32"><path class="scroll-to-top-btn-icon" d="M30,22.656l-14-13-14,13"/></svg></a>
<!-- ScrollToTop Button END-->


<!-- bloc-2 -->
<div class="bloc l-bloc" id="bloc-2">
	<div class="container bloc-lg">
		<div class="row">
			<div class="col-12">
				<h5 class="mg-md text-lg-center">
					Thank ♥ You
				</h5>
				<p class="text-lg-center">
					Renxiang Jia,2024
				</p>
			</div>
		</div>
	</div>
</div>
<!-- bloc-2 END -->

</div>
<!-- Main container END -->



<script th:src="@{/js/jquery.min.js}"  type="text/javascript" charset="utf-8"></script>
<script th:src="@{/js/vue.js}"  type="text/javascript" charset="utf-8"></script>
<script th:src="@{/js/axios.min.js}"  type="text/javascript" charset="utf-8"></script>

<script th:inline="javascript">
	var draft=new Vue({
		el:"#form_26540",  //作用范围：id=form_38623的标签及其内部
		data: {
			checkBeginTime:true,
			checkEndTime:false,
			checkContract:false,
			checkEndTime2:false,
		},
		data () {
			return {
				checkBeginTime:false,
				checkEndTime:false,
				checkContract:false,
				checkEndTime2:false,
			}
		},
		methods:{
			send:function (){
				var name= $("#name_26540").val();
				var date1=$("#start_time").val();
				var y1=date1.split("-")[0];
				var m1=date1.split("-")[1];
				var d1=date1.split("-")[2];
				var time1=new Date(y1,m1,d1);
				var date2=$("#end_time").val();
				var y2=date2.split("-")[0];
				var m2=date2.split("-")[1];
				var d2=date2.split("-")[2];
				var time2=new Date(y2,m2,d2);
				var dayCount =(time2 - time1);

				this.checkContract=false;
				this.checkBeginTime=false;
				this.checkEndTime=false;
				this.checkEndTime2=false;
				if(name.length==0){
					this.checkContract=true;
				}else if(date1.length==0){
					this.checkBeginTime=true;
				}else if(date2.length==0){
					this.checkEndTime=true;
				}
				else if(dayCount<0){
					this.checkEndTime2=true;
				}else{
					//submit
					var theForm = document.getElementById("form_26540");
					theForm.submit();
				}
			}
		},
		mounted : function () {
			var customerId = [[${contractObject.customerid}]];
			var select = document.getElementById("select_customer");
			for (var i = 0; i < select.options.length; i++){
				if (select.options[i].value == customerId){
					select.options[i].selected = true;
					break;
				}
			}
		}
	})
</script>
</body>
</html>
